/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmnotaf.java
 *
 * Created on 19/02/2011, 01:30:52 AM
 */
package interfaz1;

import java.util.Collections;
import java.util.LinkedList;
import java.util.ListIterator;

/**
 *
 * @author CLIENTE
 */
public class Frmnotaf extends javax.swing.JFrame {

    /** Creates new form Frmnotaf */
    public Frmnotaf() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        JtabNotaF = new javax.swing.JTable();
        JbtnGenerar = new javax.swing.JButton();
        btnsalirnf = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Listados");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        jLabel1.setText("Ordenados Por Nota Final");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 20, 190, -1));

        JtabNotaF.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Cedula", "Nombre", "Apellido", "Nota Final"
            }
        ));
        jScrollPane1.setViewportView(JtabNotaF);

        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, 350, 270));

        JbtnGenerar.setText("Generar");
        JbtnGenerar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JbtnGenerarActionPerformed(evt);
            }
        });
        getContentPane().add(JbtnGenerar, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 350, 80, -1));

        btnsalirnf.setText("Salir");
        btnsalirnf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirnfActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirnf, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 350, 80, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-472)/2, (screenSize.height-427)/2, 472, 427);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirnfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirnfActionPerformed

        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_btnsalirnfActionPerformed

    private void JbtnGenerarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JbtnGenerarActionPerformed
        // TODO add your handling code here:
        Collections.sort(FrmOperacionesseccion.getMiseccion().lis_est,new ComparadorNotaF());
        LinkedList<Estudiante> lis = FrmOperacionesseccion.getMiseccion().getlis_est();
        ListIterator<Estudiante> it = lis.listIterator();
        int indice = 0;

        while (it.hasNext()) {
            Estudiante e = it.next();
            JtabNotaF.setValueAt(e.getCedula(), indice, 0);
            JtabNotaF.setValueAt(e.getNombre(), indice, 1);
            JtabNotaF.setValueAt(e.getApellido(), indice, 2);
            JtabNotaF.setValueAt(e.getNotaf(), indice, 3);
            indice++;
        }
    }//GEN-LAST:event_JbtnGenerarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frmnotaf().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JbtnGenerar;
    private javax.swing.JTable JtabNotaF;
    private javax.swing.JButton btnsalirnf;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
